package com.g4.shoppingback.controller;

import com.g4.shoppingback.common.PageVo;
import com.g4.shoppingback.common.Result;
import com.g4.shoppingback.service.DdLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/shoppingback/DdLogs")
public class DdLogsController {

    @Autowired
    private DdLogsService ddLogsService;

    /**
     * 根据分页信息或用户名查询日志
     * @param pageVo 封装了查询关键字和页数
     * @return 返回分页信息
     */
    @PreAuthorize("hasAnyAuthority('miShop:log:find')")
    @GetMapping
    public Result selectUserByPage(PageVo pageVo){
        PageVo pageResult = ddLogsService.selectLogsByPaged(pageVo);
        return Result.ok(pageResult);
    }
}
